<?php

namespace Acme\FirmUsersBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Acme\FirmUsersBundle\Entity\Role;
use Acme\FirmUsersBundle\Entity\User;
use Acme\FirmsBundle\Entity\CategoryFirms;

class LoadUserData implements FixtureInterface {

  public function load($manager) {
    $role_client = new Role();
    $role_firm = new Role();
    $role_admin = new Role();
    $category_firms = new CategoryFirms();
    $category_firms->setName('ИТ');
    $role_firm->setName('ROLE_FIRM');
    $role_client->setName('ROLE_CLIENT');
    $role_admin->setName('ROLE_ADMIN');
    $user = new User();
    $user->setUsername('admin');
    $user->setPassword('admin');
    $user->setEmail('admin@admin.com');
    $user->getUserRoles()->add($role_admin);
    $manager->persist($role_admin);
    $manager->persist($user);
    $manager->persist($category_firms);    
    $manager->persist($role_client);
    $manager->persist($role_firm);
    $manager->flush();
  }

}

?>
